<?php

namespace App\Models\user;

use App\Models\base\traits\HasOwner;
use App\Models\user\observe\AddressObserve;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\user\Address
 *
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address query()
 * @mixin \Eloquent
 * @property int $id
 * @property int $user_id 关联用户ID
 * @property string $detail 地址详情
 * @property string $phone 联系电话
 * @property int $is_default 是否为默认地址
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereDetail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereIsDefault($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereUserId($value)
 * @property-read \App\Models\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address owner($userId)
 * @property string $name 联系人
 * @property int $p_id 省ID
 * @property int $c_id 城市ID
 * @property int $d_id 区ID
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereCId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereDId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address wherePId($value)
 * @property string $p_name 省名
 * @property string $c_name 城市名
 * @property string $d_name 区名
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereCName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereDName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address wherePName($value)
 * @property int $p_code 省邮编
 * @property int $c_code 市邮编
 * @property int $d_code 区邮编
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereCCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address whereDCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\user\Address wherePCode($value)
 */
class Address extends Model
{
    use HasOwner;

    public static function boot()
    {
        parent::boot();
        static::observe(new AddressObserve());

    }

    protected $fillable = [
        'user_id',
        'detail',
        'phone',
        'is_default',
        'name',
        'p_id',
        'c_id',
        'd_id',
        'p_name',
        'c_name',
        'd_name',
        'p_code',
        'c_code',
        'd_code',
    ];
}
